<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'addGoods.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<link rel="stylesheet" type="text/css" href="res/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="res/css/bootstrap-responsive.min.css">
    <link rel="stylesheet" type="text/css" href="res/css/style.css">
    <script type="text/javascript" src="res/js/jquery-1.9.1.min.js"></script>

  </head>
  
  <body>
    <%@include file="../template/header.jsp" %>
    
    <div class="subHead">
        <div class="container">
            <h1>商家管理后台</h1>
            <p class="lead">商家可以在此修改商品，修改商品类别，添加子店铺账户（总店管理员）等。</p>
        </div>
    </div>
    <div class="row mainContent">
        
        <%@include file="../template/shopNav.jsp" %>
        
        <div class="span9">
            <form class="form-horizontal" method="post" enctype="multipart/form-data" action="shop/addMyGoods.htm">
                <legend class="text-warning">添加商品</legend>
                <div class="control-group">
                    <label class="control-label" for="name">商品名称:</label>
                    <div class="controls">
                        <input type="text" id="name" name="name" placeholder="请输入商品名称">
                        <span class="help-inline">1-5个字符</span>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="minImage">商品图:</label>
                    <div class="controls">
                        <input id="minImage" name="minImage" type="file">
                        <span class="help-inline"></span>
                    </div>
                </div>
                
                <!-- 
                <div class="control-group">
                    <label class="control-label" for="midImage">商品中图:</label>
                    <div class="controls">
                        <input id="midImage" name="midImage" type="file">
                        <span class="help-inline">420*420像素</span>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="maxImage">商品大图:</label>
                    <div class="controls">
                        <input id="maxImage" name="maxImage" type="file">
                        <span class="help-inline">840*840像素</span>
                    </div>
                </div>
                -->
                
                <div class="control-group">
                    <label class="control-label">
                    	商品尺寸:
                    	<a href="#" class="btn btn-mini btn-success" onclick="addKeyword();return false;">添加</a>
                    	<a class="btn btn-mini btn-danger" onclick="deleteKeyword()">删除</a>
                    </label>
                    
                    <div id="keywordsCollection" class="controls">
                    	<div id="template" class="inline">
                    		<span class="help-inline">尺寸:</span>
                    		<input type="text" id="types" name="types" class="input-small" placeholder="请输入尺寸类型">
                    		<span class="help-inline">价格:</span>
                       		<input type="text" id="prices" name="prices" class="input-small" placeholder="请输入该尺寸价格">
                       		<span class="help-inline">默认:</span>
                       		<select name="defauls" class="span1">
                       			<option selected="selected" value="false">否</option>
                       			<option value="true">是</option>
                       		</select>
                    	</div>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="description">商品介绍:</label>
                    <div class="controls">
                        <input type="text" id="description" name="description" placeholder="请输入商品介绍">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="categoryIds">商品类别:</label>
                    <div class="controls">
                        <select id="categoryIds" name="categoryIds" multiple="multiple">
                            <s:iterator value="#request.categories" id="categories">
                            	<s:iterator value="#categories" id="category">
                            		<option value='<s:property value="#category.id" />'>
                            			<s:if test="#category.deep == 1">
               								<s:property value="#category.name"/>
               							</s:if>
               							<s:else>
               								<s:iterator begin="0" end="((#category.deep-1) * 3) - 1">
               									-
               								</s:iterator>
               								<s:property value="#category.name"/>
               							</s:else>
                            		</option>
                            	</s:iterator>
                            </s:iterator>
                        </select>
                        <span class="help-inline"></span>
                    </div>
                </div>
                <div class="control-group">
                    <div class="controls">
                        <button type="submit" class="btn">提交</button>
                        <button type="reset" class="btn">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <div class="footer">
        <p>版权所有： 银盒子计划团队</p>
    </div>
    
    <script type="text/javascript" src="../js/bootstrap.min.js"></script>
    <script type="text/javascript">
    
    function addKeyword(){
        var template = $("#template").clone();
        $("#keywordsCollection").append(template);
    }
        
    function deleteKeyword(){
        var keywords = $("#keywordsCollection").find("div");
        var size = keywords.size();
        if(size > 1){
        	$("#keywordsCollection").find("div:last").remove();
        }
        	
        return false;
    }
    
    $('li[name=templateHeader]').each(function(){
    	var that = $(this);
    	that.removeClass("active");
    
    });
	$("#templateHeader2").addClass("active"); 
	
	$('li[name=shopNav]').each(function(){
        	var that = $(this);
        	that.removeClass("active");
    });
    $("#shopNav2").addClass("active");   
    
    </script>
    
  </body>
</html>
